<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head lang="en">
    <meta charset="utf-8"/>
    <title>个人信息</title>
    <link rel="stylesheet" type="text/css" href="css/public.css"/>
    <link rel="stylesheet" type="text/css" href="css/mygrxx.css"/>
</head>
<body>
<div class="head ding">
    <div  th:replace="common :: head" ></div>

</div>
<div class="address mt">
    <div class="wrapper clearfix"><a href="index.html" class="fl">首页</a><span>/</span><a href="mygxin.html" class="on">个人信息</a>
    </div>
</div><!------------------------------Bott------------------------------>
<div class="Bott">
    <div class="wrapper clearfix">
        <div  th:replace="common :: zuoFl"></div>
        <div class="you fl"><h2>修改密码</h2>
            <form onsubmit="return false" class="remima">
                <p><span>原密码：</span><input type="text" id="oldPassword" required/></p>
                <p class="op">输入原密码</p>
                <p><span>新密码：</span><input type="text" id="newPassword" required/></p>
                <p class="op">6-16 个字符，需使用字母、数字或符号组合，不能使用纯数字、纯字母、纯符号</p>
                <p><span>重复新密码：</span><input type="text" id="newPassword2" required/></p>
                <p class="op">请再次输入密码</p>
                <input type="submit" onclick="remima(this.name,this.id)" th:id="${session.portalUser.id}" th:name="${session.portalUser.password}" value="提交"/>
            </form>
        </div>
    </div>
</div>
<div th:replace="common :: gotop"></div>

<div  th:replace="common :: footer"></div>
<script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/public.js" type="text/javascript" charset="utf-8"></script>
<script src="js/user.js" type="text/javascript" charset="utf-8"></script>
<script src="js/md5.js" type="text/javascript" charset="UTF-8"></script>
<script src="js/sweetalert.js"> </script>
<script>
    function remima(oldPa,id) {
        console.log(oldPa,id)
        var oldPassword = $("#oldPassword").val();
        var newPassword = $("#newPassword").val();
        var newPassword2 = $("#newPassword2").val();
        if (oldPassword.length==0 || newPassword.length==0 || newPassword2.length==0){
            return;
        }
        if (hex_md5(oldPassword)!=oldPa){
            swal("OMG!", "原密码输入错误！！", "error")
            return
        }

        if (newPassword!=newPassword2){
            swal("OMG!", "两次密码输入不一样！！", "error")
            return
        }
        window.location.replace("/user/changePassword?password="+newPassword+"&id="+id)

    }
</script>
</body>
</html>